//
//  MainViewController.swift
//  0623微博(swift)
//
//  Created by 岳挺 on 15/6/24.
//  Copyright © 2015年 yueting. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        
        addChildViewControllers()
    }
    
    func addChildViewControllers(){
        addChildViewController(HomeTableViewController(), title:"首页", imageName: "tabbar_home")
        addChildViewController(DiscoverTableViewController(), title:"发现", imageName: "tabbar_discover")
        addChildViewController(MessageTableViewController(), title:"消息", imageName: "tabbar_message_center")
        addChildViewController(ProfileTableViewController(), title:"我", imageName: "tabbar_profile")
    }
    
    func addChildViewController(vc:UIViewController, title:String, imageName:String){
        
        tabBar.tintColor = UIColor.orangeColor()
        vc.title = title
        vc.tabBarItem.image = UIImage(named: imageName)
        vc.tabBarItem.selectedImage = UIImage(named: imageName + "_heightlighted")
        
        let nav = UINavigationController(rootViewController: vc)
        addChildViewController(nav)
        
    }

}
